<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    function fn(){
      console.log(`函数2执行了`)
    }
    function fn2(x = 0,y = 0){
      console.log(x+y)
    }
    //开启定时器
    // setInterval(函数名称,间隔时间)
    setInterval(function(){
      console.log(`执行了`)
    },1000)
    //另外一种写法(了解) ,用引号把fn()包裹,否则不能带括号
    let p = setInterval(`fn2(2,5)`,1000)
    //注意每个计时器都有一个独一无二的编号标记
    let n = setInterval(fn,1000) //number类型的编号
    //关闭定时器
    clearInterval(1)
    clearInterval(n)
    clearInterval(p)
  </script>
</body>
</html>